#include<stdio.h>
  
int is_ugly(int number)
{   
	while (number % 2 == 0)
        number /= 2;
    while (number % 3 == 0)
        number /= 3;
    while (number % 5 == 0)
        number /= 5;
    if (number==1)
    	return 1;
    else 
    	return 0;
}
  
int main() 
{
    int n,i,x,count=0,flag=0;
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
    	scanf("%d",&x);
    	if (x==1)
    		printf("false\n");
    	else
		{
        	if (is_ugly(x) == 1)
				printf("true\n");
        	else 
        		printf("false\n");
    	}
	}
    return 0;
}
